package com.xm.mapper;

import com.xm.entity.User;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface UserMapper {
    // 查询，可以实现登录功能
    @Select("select * from users where username=#{username}")
    User findByUsername(String username);

    @Select("select * from users where id=#{id}")
    User selectById(Integer id);

    @Select("select * from users")
    List<User> selectAll();

    @Insert("insert into users(username,password) values (#{username},#{password})")
    int insertUser(User user);

    @Delete("delete from users where id=#{id}")
    int deleteUser(Integer id);

    @Update("update users set username=#{username},password=#{password} where id=#{id}")
    int updateUser(User user);
}
